#include <iostream>
using namespace std;

int main(int argc, char const *argv[])
{
    int n, num = 0, b = 0;
    string s;
    cin >> n >> s;
    for (int i = 0; i < n - 1; i++)
    {
        if (s[i] == 'V' && s[i + 1] == 'K')
        {
            num++;
        }
        else if (s[i] == s[i + 1]&& b == 0)
        {
            if (i > 0 &&s[i] == 'K' && s[i - 1] == 'V')
            {
                continue;
            }
            else if (s[i] == 'V' && s[i + 2] == 'K' && i + 2 < n )
            {
               continue;
            }
            b = 1;
        }
    }
    cout << num + b << endl;

    return 0;
}
